#!/bin/bash

echo "Starting MCP Server and Client..."

# 检查Python是否安装
if ! command -v python3 &> /dev/null; then
    echo "Python3 is not installed"
    exit 1
fi

# 检查是否安装了必要的包
echo "Checking dependencies..."
pip3 install -r requirements.txt

# 启动服务器（在后台）
echo "Starting MCP Server..."
python3 mcp_server.py &
SERVER_PID=$!

# 等待服务器启动
echo "Waiting for server to start..."
sleep 5

# 启动客户端
echo "Starting MCP Client..."
python3 mcp_demo.py

# 如果客户端退出，关闭服务器
kill $SERVER_PID
echo "MCP Server and Client stopped." 